home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-20 | 1009 b | 49 lines | [TEXT/MMCC] |
- //
- // ADB Key Spy Main • Pete Gontier • gurgle@apple.com
- // Macintosh Developer Technical Support
- // © 1995 Apple Computer, Inc.
- //
- // See "ADB Key Spy.h" for more information.
- //
-
- #ifndef __DIALOGS__
- # include <Dialogs.h>
- #endif
-
- #ifndef __FONTS__
- # include <Fonts.h>
- #endif
-
- #include "ADB Key Spy.h"
-
- void main (void)
- {
- Boolean scratch;
- EventRecord event;
-
- InitGraf (&(qd.thePort));
- InitFonts ( );
- InitWindows ( );
- InitMenus ( );
- TEInit ( );
- InitDialogs (nil);
-
- AKS_AcquireKeyboards ( );
-
- //
- // This is a more interesting sequence than one might guess.
- // Since this package now performs raw-to-virtual key code translation,
- // it's non-trivial to pass the key code from an event record to
- // AKS_IsKeyDownAnywhere.
- //
-
- while (!WaitNextEvent (keyDownMask,&event,0xFFFFFFFF,nil))
- ;
- scratch = AKS_IsKeyDownAnywhere ((event.message & keyCodeMask) >> 8);
-
- AKS_RelinquishKeyboards ( );
-
- if (!scratch)
- DebugStr ("\pWhoa! A keyDown event was posted for a key that isn't down!");
- }
-